<template>
	
	<el-form :model="form" label-width="auto" style="max-width: 100vw">
		<el-form-item>
			<el-row :gutter="20" style="width: 100%; background-color: seagreen;">
				<el-col :span="5">
					<span><h3>AQI空气质量指数超标趋势</h3></span>
				</el-col>
			</el-row>
		</el-form-item>
		<el-form-item>
			<el-table :data="tabledata" style="width: 60%"   >
			   <el-table-column label="序号"  >
				   <template #default="scope">
						{{ scope.$index + 1 }}
					</template>
			   </el-table-column>
			   <el-table-column prop="month" label="月份" />
			   <el-table-column prop="count" label="AQI空气质量指数超标数量" />
 
			 </el-table>
		</el-form-item>
	</el-form>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router';
import axios from '@/axios';
import { onMounted,ref } from 'vue';

const tokenValue=localStorage.getItem('token')
const router=useRouter()
const route=useRoute()
const routequery=route.query


const tabledata=ref()
const datalist=ref()
const fetchData=async ()=>{
	try{
		axios.get('/service-admin/verification/getAqiStatsByMonth',
		{
			headers: {
			  'Authorization': `Bearer ${tokenValue}` // 在请求头中添加 Bearer Token
			},
		})
		.then(res=>{
			datalist.value=res.data.sendResult
			tabledata.value=datalist.value
			console.log("datalist数据是：",datalist.value)
		})
	}catch(e){
		console.error('报错',e.message)
	}
}
onMounted(()=>{
	fetchData()
})

</script>

<style>
</style>